package com.socool.sinofaith.ui;

import java.util.List;

import net.tsz.afinal.FinalHttp;
import net.tsz.afinal.http.AjaxCallBack;
import net.tsz.afinal.http.AjaxParams;

import android.os.Bundle;
import android.text.Html;
import android.text.TextUtils.TruncateAt;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.deying.actionbarcompat.ActionBarHelperBase;
import com.deying.actionbarcompat.ActionBarHelperBase.CenterViewFactory;
import com.deying.actionbarcompat.ActionBarHelperBase.SpinnerViewFactory;
import com.socool.sinofaith.R;
import com.socool.sinofaith.SocoolApplication;
import com.socool.sinofaith.dao.QuestionAnswerDao;
import com.socool.sinofaith.jsonparse.HttpJsonAdapter;
import com.socool.sinofaith.model.BaseMessage;
import com.socool.sinofaith.model.QuestionAnswerBean;
import com.socool.sinofaith.model.QuestionAnswerReqBean;
import com.socool.sinofaith.model.NoticeBean.Notice;
import com.socool.sinofaith.util.ConstansJsonUrl;
import com.socool.sinofaith.util.SinofaithUtil;
/**
 *通知详细
 * @author maxhsh
 *
 */
public class NoticeDetailActivity extends BaseActivity implements
		CenterViewFactory, SpinnerViewFactory, View.OnClickListener {
	ActionBarHelperBase mActionBarHelperBase;
	private TextView messageContent,messageTitle,messageTime;
	Notice mNotice;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_detail);
		SocoolApplication.addActivity(this);
		mActionBarHelperBase = (ActionBarHelperBase) this.getActionBarHelper();
		mActionBarHelperBase.setmCenterViewFactory(this);
		mActionBarHelperBase.setmSpinnerViewFactory(this);
		mActionBarHelperBase.setmClickListener(this);
		
		messageContent = (TextView)findViewById(R.id.messageContent);
		messageTitle=(TextView) findViewById(R.id.messageTitle);
		messageTime=(TextView) findViewById(R.id.messageTime);
		
		mNotice = (Notice) this.getIntent().getSerializableExtra("mNotice");
		messageTitle.setText(mNotice.getTitle().trim());
		messageTime.setText(mNotice.getSendTime().trim());
		messageContent.setText(Html.fromHtml(mNotice.getMessageContent()));
		
	}
	

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		MenuInflater menuInflater = getMenuInflater();
		menuInflater.inflate(R.menu.common, menu);
		return super.onCreateOptionsMenu(menu);
	}

	public View createView() {

		TextView tv = new TextView(this);
		tv.setText(mNotice.getTitle());
		tv.setTextColor(this.getResources().getColor(R.color.white));
		tv.setTextSize(20);
		tv.setSingleLine(true);
		tv.setMaxEms(10);
		tv.setEllipsize(TruncateAt.END);
		return tv;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated
															// method stub
		if (item.getItemId() == R.id.home) {
			finish();
			return true;
		}
		return super.onOptionsItemSelected(item);
	}

	@Override
	public View createSpinnerView() {
		ImageView imageview = new ImageView(this);
		return imageview;
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	public void onClick(View arg0) {
		switch (arg0.getId()) {
		case R.id.btnPrevious:
			break;
		}
	}

}
